package superBarbershop;

import java.util.LinkedList;

public class Registro {
    private static LinkedList<String[]> registros = new LinkedList<>();
    
    private Registro() {
    }
    
    public static String[][] registros() {
        return registros.toArray(new String[registros.size()][4]);
    }
    
    public static void agregar(int id, int ts, int tc) {
        String[] arr = {String.valueOf(id),
                        String.valueOf(ts),
                        String.valueOf(tc), "-", "-", "-", "-", "-"};
        registros.add(arr);
    }
    
    public static void actualizar(long campo, int i, int j) {
        registros.get(i - 1)[j] = formatear(campo);
    }
    
    public static String formatear(long num) {
       String res;
       if (num == 0)
           return "-";
       num = num - Peluqueria.TIEMPO;
       if(((num % 60000) / 1000) < 10)
           res = num / 60000 + ":0" + ((num % 60000) / 1000);
       else
           res = num / 60000 + ":" + (num % 60000) / 1000;

       return res;
    }
}
